//
//  SystemMessageCommon.m
//  bestkeep
//
//  Created by 李明 on 2016/11/22.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "SystemMessageCommon.h"
#import "RequestManager.h"
@implementation SystemMessageCommon

NSString * const formalEnvironmentSystemMessageStrBKAPI = @"http://api.bestkeep.cn/";

NSString * const systemMessageStrBKAPI = @"http://api.test.bestkeep.cn/";
NSString * const systemMessage = @"msg/getUserSysMsg";


+ (NSString *)formalEnvironment:(NSString *)url {
    if (ApplicationEnvironmentProduction == 1) {
        return [formalEnvironmentSystemMessageStrBKAPI stringByAppendingString:url];
    }
    return [systemMessageStrBKAPI stringByAppendingString:url];
}

+ (void)getSystemMessageListWithUserid:(NSString *)userId pagesize:(int)pageSize pageno:(int)pageNo mycallBack:(SystemMessageCallback)callback {
    NSString *url = [self formalEnvironment:systemMessage];
    NSDictionary *bodyDic= @{@"userId":userId,
                             @"pageSize":[NSString stringWithFormat:@"%ld",(long)pageSize],
                             @"pageNo":[NSString stringWithFormat:@"%ld",(long)pageNo]
                             };

    [[RequestManager manager] bkDataRequest:RequestMethodPost URLString:url parameters:bodyDic success:^(id  _Nullable responseObject) {
        callback(responseObject, nil);
        
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        callback(nil, error);
    }];
    
}

@end
